package com.blb.springboot.config;


import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //在拦截器注册中添加自定义拦截器
        registry.addInterceptor(null)
                //配置拦截路径 /**代表所有路径
                .addPathPatterns("/**")
                //排除路径
                .excludePathPatterns("/**/login.html","/**/*.js","/**/*.css");

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置url中带images的路径
        registry.addResourceHandler("/images/**")
        .addResourceLocations("file:D//images/");
    }


}
